<?php
namespace app\index\model;

use think\Model;

class Profile extends Model
{
    //设置完整的数据表(包含前缀)
    protected $table = 'think_profile';

    //修改器
    protected function setBirthdayAttr($value)
    {
        return strtotime($value);
    }

    protected $type = [
        'birthday' => 'timestamp: Y-m-d',
    ];

    //hasOne('关联模型名','关联外键','主键','别名定义','join类型')
    //belongsTo('关联模型名','关联外键','关联模型主键','别名定义','join类型')
    public function user()
    {
        //档案 BELONGS TO 关联用户
        return $this->belongsTo('User');
    }

}
